package com.xsp.exception;

import com.xsp.entity.CommonResult;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author xsp
 * @date 2024/2/28
 * @desc 自定义全局异常处理器
 */
@RestControllerAdvice(basePackages = {"com.xsp.controller"})
public class MyExceptionHandler {
    @ExceptionHandler
    public CommonResult handlerException(Exception e) {
        return CommonResult.error(e.getMessage());
    }
}
